package com.sebastian.studies.ch8;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Scanner;

public class FileProcessing {

	public static void main(String[] args) throws IOException {

		File file = new File("image/us.jpg");
		//new File("image/kupa.txt");
		//boolean isFilePresent = file.exists();
		
		System.out.println("File exist (image/us.jpg): " + file.exists() + " | File length: " +
			file.length());
		
		File txtFile = new File("scores.txt");
		if (txtFile.exists()) {
			System.out.println("File already exists");
		} else {
			PrintWriter output = new PrintWriter(txtFile);
			output.print("Dupa Kupa");
			output.close();
		}
		Scanner input = new Scanner(txtFile);
		String textFromFile = input.next();
		System.out.println(textFromFile);
		input.close();
		
	}
}
